require 'rbrainz'
include MusicBrainz

module Lookup
	def self::search( string )
		filter = Webservice::ReleaseFilter.new( :query => string )
		query  = Webservice::Query.new
		results = query.get_releases( filter )

		results.each do |res|
			entity = res.entity
			puts( "#{res.score}: #{entity.artist} - #{entity.title} (#{entity.tracks.count})" )
		end
	end
end

if __FILE__ == $0
	#This is the ruby pattern that says only do this bit if we were evoked from the command line.
	string = ARGV[0]
	ret = Lookup::search( string )
end

